package com.yy.sso.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yy.sso.order.mapper.OrderMapper;
import com.yy.sso.order.model.Order;
import com.yy.sso.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {

    @Autowired
    private OrderMapper orderMapper;

    /**
     * 根据用户id查询订单信息
     *
     * @param userId
     * @return
     */
    @Override
    public List<Order> getOrderListByUserId(Long userId) {
        QueryWrapper<Order> wrapper = new QueryWrapper();
        wrapper.eq("user_id", userId);
        return this.orderMapper.selectList(wrapper);
    }
}
